﻿using System.Collections.Generic;
using MigratorCore.Status;
using MigratorCore.Bases;
namespace MigratorCore.Status
{
    /// <summary>
    /// Status Class for dealing with provider status
    /// </summary>
    public sealed class Status : List<Event>
    {
        /// <summary>
        /// % Completed
        /// </summary>
        private int completed;

        public event MirgratorChangedEventHandler Change;

        /// <summary>
        /// % Completed
        /// </summary>
        public int Completed
        {
            get { return completed; }
            set { completed = value; OnChange(); }
        }

        public void AddEvent(Event Event)
        {
            this.Add(Event);
            OnChange();
        }

        private void OnChange()
        {
            if (Change != null)
                Change();
        }

        /// <summary>
        /// Default Constructor
        /// </summary>
        public Status()
        {
            this.Clear();
            completed = 0;
        }
    }
}
